/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.smarttmt.smartmanager.entity;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author nicolas
 */
@Entity
@Table(name = "FORMULA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Formula.findAll", query = "SELECT f FROM Formula f"),
    @NamedQuery(name = "Formula.findByFormcodi", query = "SELECT f FROM Formula f WHERE f.formcodi = :formcodi"),
    @NamedQuery(name = "Formula.findByFormdesc", query = "SELECT f FROM Formula f WHERE f.formdesc = :formdesc"),
    @NamedQuery(name = "Formula.findByFormform", query = "SELECT f FROM Formula f WHERE f.formform = :formform"),
    @NamedQuery(name = "Formula.findByFormcoan", query = "SELECT f FROM Formula f WHERE f.formcoan = :formcoan"),
    @NamedQuery(name = "Formula.findByFormtabl", query = "SELECT f FROM Formula f WHERE f.formtabl = :formtabl"),
    @NamedQuery(name = "Formula.findByFormterm", query = "SELECT f FROM Formula f WHERE f.formterm = :formterm"),
    @NamedQuery(name = "Formula.findByFormdigi", query = "SELECT f FROM Formula f WHERE f.formdigi = :formdigi"),
    @NamedQuery(name = "Formula.findByFormfesi", query = "SELECT f FROM Formula f WHERE f.formfesi = :formfesi"),
    @NamedQuery(name = "Formula.findByFormpers", query = "SELECT f FROM Formula f WHERE f.formpers = :formpers"),
    @NamedQuery(name = "Formula.findByFormutli", query = "SELECT f FROM Formula f WHERE f.formutli = :formutli"),
    @NamedQuery(name = "Formula.findByFormfopl", query = "SELECT f FROM Formula f WHERE f.formfopl = :formfopl"),
    @NamedQuery(name = "Formula.findByFormclas", query = "SELECT f FROM Formula f WHERE f.formclas = :formclas"),
    @NamedQuery(name = "Formula.findByFormvweb", query = "SELECT f FROM Formula f WHERE f.formvweb = :formvweb")})
public class Formula implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "FORMCODI")
    private String formcodi;
    @Size(max = 40)
    @Column(name = "FORMDESC")
    private String formdesc;
    @Size(max = 3000)
    @Column(name = "FORMFORM")
    private String formform;
    @Size(max = 10)
    @Column(name = "FORMCOAN")
    private String formcoan;
    @Size(max = 10)
    @Column(name = "FORMTABL")
    private String formtabl;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 60)
    @Column(name = "FORMTERM")
    private String formterm;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "FORMDIGI")
    private String formdigi;
    @Basic(optional = false)
    @NotNull
    @Column(name = "FORMFESI")
    @Temporal(TemporalType.TIMESTAMP)
    private Date formfesi;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 6)
    @Column(name = "FORMPERS")
    private String formpers;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1)
    @Column(name = "FORMUTLI")
    private String formutli;
    @Size(max = 2000)
    @Column(name = "FORMFOPL")
    private String formfopl;
    @Size(max = 4)
    @Column(name = "FORMCLAS")
    private String formclas;
    @Column(name = "FORMVWEB")
    private BigInteger formvweb;
    @OneToMany(mappedBy = "actiform", fetch = FetchType.LAZY)
    private List<Activida> actividaList;

    public Formula() {
    }

    public Formula(String formcodi) {
        this.formcodi = formcodi;
    }

    public Formula(String formcodi, String formterm, String formdigi, Date formfesi, String formpers, String formutli) {
        this.formcodi = formcodi;
        this.formterm = formterm;
        this.formdigi = formdigi;
        this.formfesi = formfesi;
        this.formpers = formpers;
        this.formutli = formutli;
    }

    public String getFormcodi() {
        return formcodi;
    }

    public void setFormcodi(String formcodi) {
        this.formcodi = formcodi;
    }

    public String getFormdesc() {
        return formdesc;
    }

    public void setFormdesc(String formdesc) {
        this.formdesc = formdesc;
    }

    public String getFormform() {
        return formform;
    }

    public void setFormform(String formform) {
        this.formform = formform;
    }

    public String getFormcoan() {
        return formcoan;
    }

    public void setFormcoan(String formcoan) {
        this.formcoan = formcoan;
    }

    public String getFormtabl() {
        return formtabl;
    }

    public void setFormtabl(String formtabl) {
        this.formtabl = formtabl;
    }

    public String getFormterm() {
        return formterm;
    }

    public void setFormterm(String formterm) {
        this.formterm = formterm;
    }

    public String getFormdigi() {
        return formdigi;
    }

    public void setFormdigi(String formdigi) {
        this.formdigi = formdigi;
    }

    public Date getFormfesi() {
        return formfesi;
    }

    public void setFormfesi(Date formfesi) {
        this.formfesi = formfesi;
    }

    public String getFormpers() {
        return formpers;
    }

    public void setFormpers(String formpers) {
        this.formpers = formpers;
    }

    public String getFormutli() {
        return formutli;
    }

    public void setFormutli(String formutli) {
        this.formutli = formutli;
    }

    public String getFormfopl() {
        return formfopl;
    }

    public void setFormfopl(String formfopl) {
        this.formfopl = formfopl;
    }

    public String getFormclas() {
        return formclas;
    }

    public void setFormclas(String formclas) {
        this.formclas = formclas;
    }

    public BigInteger getFormvweb() {
        return formvweb;
    }

    public void setFormvweb(BigInteger formvweb) {
        this.formvweb = formvweb;
    }

    @XmlTransient
    public List<Activida> getActividaList() {
        return actividaList;
    }

    public void setActividaList(List<Activida> actividaList) {
        this.actividaList = actividaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (formcodi != null ? formcodi.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Formula)) {
            return false;
        }
        Formula other = (Formula) object;
        if ((this.formcodi == null && other.formcodi != null) || (this.formcodi != null && !this.formcodi.equals(other.formcodi))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.smarttmt.smartmanager.entity.Formula[ formcodi=" + formcodi + " ]";
    }
    
}
